import request from '@/utils/request'

/**
 * 获取部门列表
 * @returns
 */
export const getDepartmentsListApi = () => {
  return request({
    url: '/company/department'
  })
}

/**
 * 删除部门接口
 * @param {*} id 部门id
 * @returns
 */
export const delDepartmentsApi = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * 获取部门负责列表
 * @returns
 */
export const getUserSimpleListApi = () => {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 * 添加部门
 * @param {*} form 添加部门所需数据
 * @returns
 */
export const addDepartmentApi = form => {
  return request({
    url: '/company/department',
    method: 'post',
    data: form
  })
}

/**
 * 获取部门详情
 * @param {*} id 部门id
 * @returns
 */
export const getDepartmentDetailApi = id => {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 修改部门
 * @param {*} data 修改部门的参数
 * @returns
 */
export const editDepartmentApi = data => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
